[速報] Meta の Llama 2 70B が Amazon Bedrock で利用可能になりました #AWSreInvent

[速報] Meta の Llama 2 70B が Amazon Bedrock で利用可能になりました #AWSreInvent

Clock Icon2023.11.30

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

こんにちは、AWS事業本部の森田です。

本日、Swami Sivasubramanian 氏のキーノートで Meta の Llama 2 70B が Amazon Bedrock で利用可能になることが発表されました。

Llama 2 70B について

以前より Llama 2 13B は利用可能でしたが、今回の発表で、Llama 2 70B が利用可能になりました。

70Bということで、より多くのパラメータを有した大規模なモデルを利用することができるようになります。

利用可能なリージョン

現在は、以下のリージョンで利用可能です。

  • バージニア北部(us-east-1)
  • オレゴン(us-west-1)

実際に試してみる

Model access

まずは、 Model access から Llama 2 70B が利用できるように有効化します。

Python SDK から呼び出す

まずは、以下のコードを実行して、モデル一覧を確認してみます。

import boto3

bedrock = boto3.client(service_name='bedrock', region_name='us-east-1')
listModels = bedrock.list_foundation_models(byProvider='meta')
print("\n".join(list(map(lambda x: f"{x['modelName']} : { x['modelId'] }", listModels['modelSummaries']))))
Llama 2 Chat 13B : meta.llama2-13b-chat-v1
Llama 2 Chat 70B : meta.llama2-70b-chat-v1
Llama 2 13B : meta.llama2-13b-v1
Llama 2 70B : meta.llama2-70b-v1

上記の出力結果中の meta.llama2-70b-chat-v1 を利用します。

import boto3
import json

prompt = "What is AWS?"

bedrock_runtime = boto3.client(
    "bedrock-runtime", 
    region_name="us-east-1"
)

body = {
    "prompt": prompt,
    'max_gen_len': 512,
	'top_p': 0.9,
	'temperature': 0.5
}

response = bedrock_runtime.invoke_model(
    modelId="meta.llama2-70b-chat-v1",
    accept='application/json',
    contentType="application/json",
    body=json.dumps(body),
)

res = json.loads(response.get("body").read())["generation"]
print(res)

AWS stands for Amazon Web Services, which is a cloud computing platform offered by Amazon. It provides a comprehensive collection of services enabling enterprises to utilize the cloud's computing, storage, and data analytics capabilities. AWS has been a popular alternative for businesses seeking to migrate their applications and data from on-premises environments to the cloud because of its scalability, flexibility, reliability, and pay-as-you-go pricing model.

AWS offers a wide range of services, including:

1. Compute Services: Allows you to select the operating system, database, programming language, and web application platform that best suits your needs.
2. Storage Services: Offers simple data storage and retrieval, as well as backup and archive capabilities.
3. Database Services: Provides managed database services for popular database engines.
4. Security, Identity & Compliance: Provides services to protect sensitive data and workloads.
5. Application Services: Includes services for building, deploying, and managing applications.
6. Analytics Services: Offers data analytics and warehousing services.
7. Machine Learning Services: Provides services for building, deploying, and managing machine learning models.
8. Networking Services: Offers services for building, deploying, and managing networks.
9. Application Development Services: Includes services for building, deploying, and managing applications.
10. RobOps Services: Provides services for building, deploying, and managing robotic process automation.
11. Internet of Things (IoT) Services: Offers services for building, deploying, and managing IoT devices and applications.

AWS has several benefits, including:

1. Scalability: AWS allows you to scale your resources up or down based on your needs, ensuring you only pay for what you use.
2. Security: AWS follows strict security best practices and provides various security features to protect your data and applications.
3. Flexibility: AWS supports various operating systems, programming languages, and databases, giving you the flexibility to choose the tools that best fit your needs.
4. Reliability: AWS has multiple availability zones and regions, ensuring high uptime and reliability for your applications.
5. Cost-effective: AWS offers a pay-

最後に

Llama 2 70B が対応したということで、Python SDK から使ってみましたが、大規模なモデルがたった数行ですぐに利用できるのは、やはり便利ですね。

現在、東京(ap-northeast-1)で利用はできないため、今後対応されるのが楽しみです。

Share this article

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.